//
//Copyright GX. Yuan
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/**
 * @file net.go
 * @brief Leetcode 剑指Offer 第二版
 * @details 剑指 Offer 27. 二叉树的镜像
 * @author GX. Yuan  any question please send mail to yuanguanxu@qq.com
 * @date 2021-6-28
 * @version V1.0
 * @attention 硬件平台: windows 10 家庭版
 * SDK版本：Go 1.16.5
 * IDE版本：GoLand 2020.2.3
 */
package main

func mirrorTree(root *TreeNode) *TreeNode {
	if root== nil { // 剪枝 ，如果没有左右子节点，返回
		return nil
	}
	// 先对子树的左右子树进行交换处理
	mirrorTree(root.Left)
	mirrorTree(root.Right)
	// 如果有的交换
	var temp *TreeNode
	temp=root.Left
	root.Left=root.Right
	root.Right=temp
	// 对子树进行同样的处理方式
	return root
}

func main() {
	
}
// 进行遍历
// 间左子树变为右子树
// 递归遍历